#ifndef QANIMAL_H
#define QANIMAL_H

#include "qlife.h"
#include "qgravity.h"
#include "qgame.h"

/**
 *	@author Stefan Weigert <stefan.weigert@mailbox.tu-dresden.de>
 */

class QAnimal : public QLife
{
	Q_OBJECT
//	Q_PROPERTY(bool isFighting READ isFighting)

	public:
		QAnimal ( QGame* parent, Dna* dna, int n, int width, int height );
		~QAnimal();

		bool isFighting();

		float getXDest();
		float getYDest();
		float getViewDistance();

//		Q_INVOKABLE void attack ( QAnimal* source, float attackStrength );
		void attack ( QAnimal* source, float attackStrength );
		QAnimal* getEnemy();

	protected:
		void run();
		void think();
		void collectData();
		QString getName();
		void initDecay();
		void decay();

	private:
		bool fighting;

		float dx, dy;
		float xDest, yDest;
		float speed;
		float maxSpeed;
		float viewDistance;

		QString name;

		QGame* game;
		QGravity* gravity;
		QAnimal* enemy;

		int getFactor ( float d, float p );
};

#endif
